<?php /* Smarty version 2.6.20, created on 2016-07-19 15:22:02
         compiled from product_launch.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'in_array', 'product_launch.htm', 138, false),array('modifier', 'count', 'product_launch.htm', 210, false),array('modifier', 'default', 'product_launch.htm', 302, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品发布</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/jquery-1.4.4.min.js" type="text/javascript" charset="utf-8" ></script>
<script src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/my_lightbox.js" type="text/javascript" charset="utf-8"></script>
<script src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/district.js" type="text/javascript" charset="utf-8"></script>
<script src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/jquery.json-2.4.js" type="text/javascript" charset="utf-8"></script>
<script language="javascript">
var weburl="<?php echo $this->_tpl_vars['config']['weburl']; ?>
";
$(function(){
	$('#customs_cat').bind('change',function(){
		var __this = $(this);
		var rate = __this.find("option:selected").attr('rate');
		var hscode = __this.find("option:selected").attr('hscode');
		var tax_paid_price = __this.find("option:selected").attr('tax_paid_price');
		if(rate>0 && hscode!=''){
			$('#tax_rate').val(rate);
			$('#hscode').val(hscode);
			$('#tax_paid_price').val(tax_paid_price);
		}
	});
	$('#hscodeForSearch').bind('input',function(){
		var hscodetemp = $(this).val();
		if(hscodetemp.length==8){
		    $.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_launch.php&operation=getCatByHscode&hscode='+hscodetemp,function(data){
		    	var d = eval('('+data+')');
		    	if(d.catid>0){
		    		var chtml = '<option value="'+d.catid+'" rate="'+d.tax_rate+'" hscode="'+d.hscode+'" tax_paid_price="'+d.tax_paid_price+'">'+d.cat+'</option>';
			    	$('#customs_cat').html(chtml);
			    	$('#tax_rate').val(d.tax_rate);
		            $('#hscode').val(d.hscode);
		            $('#tax_paid_price').val(d.tax_paid_price);
		    	}
	        });
		}
	});
});
</script>
</head>
<body>
<div class="container">
<div class="flow">
    <div class="itemtitle">
        <h3>产品详情</h3>
        <ul>
            <li class="current"><a id="base" href="javascript:;"><span>基本信息</span></a></li>
            <?php if ($this->_tpl_vars['firstvalue']['d']['0']): ?><li><a id="spec" href="javascript:;"><span>销售属性</span></a></li><?php endif; ?>
            <?php if ($this->_tpl_vars['firstvalue']['s']['0']): ?><li><a id="other" href="javascript:;"><span>其它属性</span></a></li><?php endif; ?>
            <?php if ($this->_tpl_vars['firstvalue']['p']): ?><li><a id="parameter" href="javascript:;"><span>详细参数</span></a></li><?php endif; ?>
            <?php if ($this->_tpl_vars['service']): ?><li><a id="service" href="javascript:;"><span>产品服务</span></a></li><?php endif; ?>
            <li><a id="detail" href="javascript:;"><span>商品详情</span></a></li>
            <li><a id="logistics" href="javascript:;"><span>物流信息</span></a></li>
        <!--     <li><a id="parts" href="javascript:;"><span>推荐组合</span></a></li>
            <li><a id="give" href="javascript:;"><span>赠送产品</span></a></li> -->
            <li><a id="related" href="javascript:;"><span>相关产品</span></a></li>
        </ul>
    </div>
</div>
<div class="h35"></div>
<form method="post" action="" enctype="multipart/form-data" onsubmit="return check_value();">
    <table class="table" id="base">
    <thead>
    <tr>
        <th colspan="2" class="partition">基本信息</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td width="100">所属分类</td>
        <td>
         <?php echo $this->_tpl_vars['typenames']; ?>

        <?php if (! $_GET['catid']): ?>
        <input name="catid" id="catid" type="hidden" value="<?php echo $this->_tpl_vars['de']['catid']; ?>
" />
        <input name="tcatid" id="tcatid" type="hidden" value="<?php echo $this->_tpl_vars['de']['tcatid']; ?>
" />
        <input name="scatid" id="scatid" type="hidden" value="<?php echo $this->_tpl_vars['de']['scatid']; ?>
" />
        <input name="sscatid" id="sscatid" type="hidden" value="<?php echo $this->_tpl_vars['de']['sscatid']; ?>
" />
        <?php else: ?>
        <input name="catid" id="catid" type="hidden" value="<?php echo $_GET['catid']; ?>
" />
        <input name="tcatid" id="tcatid" type="hidden" value="<?php echo $_GET['tcatid']; ?>
" />
        <input name="scatid" id="scatid" type="hidden" value="<?php echo $_GET['scatid']; ?>
" />
        <input name="sscatid" id="sscatid" type="hidden" value="<?php echo $_GET['sscatid']; ?>
" />
        <a href="module.php?m=product&s=product_launch.php&editid=<?php echo $_GET['edit']; ?>
&cat=<?php echo $_GET['catid']; ?>
&tcatid=<?php echo $_GET['tcatid']; ?>
&scatid=<?php echo $_GET['scatid']; ?>
&sscatid=<?php echo $_GET['sscatid']; ?>
">编辑</a>
        <?php endif; ?>
        </td>
    </tr>
    <tr>
        <td>产品编号</td>
        <td><input value="<?php if ($this->_tpl_vars['de']['code']): ?><?php echo $this->_tpl_vars['de']['code']; ?>
<?php else: ?>添加商品自动生成<?php endif; ?>" name="code" type="text" class="w350" disabled  /></td>
    </tr>
    
    <tr>
      <td>产品名称</td>
      <td><input maxlength="100" name="title" type="text" id="title" class="w350" value="<?php echo $this->_tpl_vars['de']['pname']; ?>
" /></td>
    </tr>
    
    <tr>
      <td>副标题/促销提示</td>
      <td>
      <textarea name="promotion_tips"   id="promotion_tips" class="w350" ><?php echo $this->_tpl_vars['de']['promotion_tips']; ?>
</textarea>
      </td>
    </tr>
    
    <tr>
      <td>国家</td>
      <td><input maxlength="100" name="guojia" type="text" id="guojia" class="w350" value="<?php echo $this->_tpl_vars['de']['guojia']; ?>
" /></td>
    </tr>
    
    
     <tr>
        <td>国家图标</td>
        <td>
        <input name="guojiapic" class="w350" type="text" id="guojiapic" value="<?php echo $this->_tpl_vars['de']['guojiapic']; ?>
" />
        [<a href="javascript:uploadfile('上传LOGO','guojiapic',42,42,'tags')">上传</a>] 
        [<a href="javascript:preview('guojiapic');">预览</a>]
        [<a onclick="javascript:$('#guojiapic').val('');" href="#">删除</a>] <span class="bz"></span>
        </td>
    </tr>
    
    <tr>
      <td>短描述(120字内)</td>
      <td>
      <textarea name="short_desc"   id="short_desc" class="w350" style="height:30px;"><?php echo $this->_tpl_vars['de']['short_desc']; ?>
</textarea>
      </td>
    </tr>
    
    
        <tr>
        <td>标签</td>
        <td>
        
        <select class="w200" id="tags" name='tags[]' multiple="multiple" size="10" style="height:auto;">
                        <?php $_from = $this->_tpl_vars['tags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        
             			<option <?php if ($this->_tpl_vars['list']['stags']): ?> disabled <?php endif; ?> <?php if (@ ((is_array($_tmp=$this->_tpl_vars['list']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['list']['tags']; ?>
</option>
                           
                            <?php $_from = $this->_tpl_vars['list']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            <option <?php if ($this->_tpl_vars['slist']['stags']): ?> disabled <?php endif; ?> <?php if (@ ((is_array($_tmp=$this->_tpl_vars['slist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['id']; ?>
">|__<?php echo $this->_tpl_vars['slist']['tags']; ?>
</option>
                            	    
                                    <?php $_from = $this->_tpl_vars['slist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['sslist']):
?>
                                    <option <?php if ($this->_tpl_vars['sslist']['stags']): ?> disabled <?php endif; ?> <?php if (@ ((is_array($_tmp=$this->_tpl_vars['sslist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['sslist']['id']; ?>
">|____<?php echo $this->_tpl_vars['sslist']['tags']; ?>
</option>
                                    
                                    <?php $_from = $this->_tpl_vars['sslist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                                    <option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['lists']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['id']; ?>
">|______<?php echo $this->_tpl_vars['lists']['tags']; ?>
</option>
                            		<?php endforeach; endif; unset($_from); ?>
                            		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
                            
                        <?php endforeach; endif; unset($_from); ?> 
            		</select>
 按住 “CTRL” 多选
        </td>
    </tr>
    
    <!-- <tr>
      <td>品名</td>
      <td><input name="ftitle" type="text" id="ftitle" class="w350" value="<?php echo $this->_tpl_vars['de']['ftitle']; ?>
" /></td>
    </tr> -->
    
    <tr>
        <td><?php echo $this->_tpl_vars['lang']['keyword']; ?>
</td>
        <td><input name="keywords" type="text" value="<?php echo $this->_tpl_vars['de']['keywords']; ?>
" class="w350" /></td>
    </tr>
    
    <tr>
        <td>品牌</td>
        <td>
<input type="hidden" name="brand" id="brandid" value="<?php if ($this->_tpl_vars['de']['brand']): ?><?php echo $this->_tpl_vars['de']['brandid']; ?>
__<?php echo $this->_tpl_vars['de']['brand']; ?>
<?php endif; ?>"/>
                    <input style="width:350px;" type='text' id='brand' value="<?php echo $this->_tpl_vars['de']['brand']; ?>
" placeholder='输入品牌部分内容筛选' autocomplete="off"/>
            		<ul id="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 150px;z-index:999;">
        			</ul>

</td>
    </tr>
    

    
    <tr>
        <td>上传图片</td>
        <td>
            <div class="product_image">
                <ul id="list1">
                    <?php $_from = $this->_tpl_vars['de']['pic']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['list']):
?>
                        <li id="p<?php echo $this->_tpl_vars['key']+1; ?>
" data-itemid='<?php echo $this->_tpl_vars['key']+1; ?>
'>
                            <div class="product_image_list">
                            	<div class="show_big"></div>
                                <div nc_type="handle_image">
                                    <div class="image">
                                    	
                                    <input name="pic[]" type="hidden" id="img<?php echo $this->_tpl_vars['key']; ?>
" value="<?php echo $this->_tpl_vars['list']; ?>
" />
                                    <?php if ($this->_tpl_vars['list']): ?>
                                    <img id="img<?php echo $this->_tpl_vars['key']; ?>
_img" src="<?php echo $this->_tpl_vars['list']; ?>
" width="60">
                                    <?php else: ?>
                                    <img width="60" id="img<?php echo $this->_tpl_vars['key']; ?>
_img" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/default/nopicsmall.gif"  />
                                    <?php endif; ?>
                                    </div>
                                    <div nc_type="handle" class="bg">
                                    <span title="删除" nctype="delete_image">删除</span>
                                    </div>
                                </div>
																
                                <div class="upload-btn"><a class="upload-button" href="javascript:uploadfile('Style images','img<?php echo $this->_tpl_vars['key']; ?>
',640,640,'product')">上传</a></div>
                            </div>
                        </li>
                    <?php endforeach; endif; unset($_from); ?>
                    <?php $this->assign('count', count($this->_tpl_vars['de']['pic'])); ?>
                    <?php unset($this->_sections['name']);
$this->_sections['name']['name'] = 'name';
$this->_sections['name']['loop'] = is_array($_loop=$this->_tpl_vars['count']*-1+10) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$this->_sections['name']['show'] = true;
$this->_sections['name']['max'] = $this->_sections['name']['loop'];
$this->_sections['name']['step'] = 1;
$this->_sections['name']['start'] = $this->_sections['name']['step'] > 0 ? 0 : $this->_sections['name']['loop']-1;
if ($this->_sections['name']['show']) {
    $this->_sections['name']['total'] = $this->_sections['name']['loop'];
    if ($this->_sections['name']['total'] == 0)
        $this->_sections['name']['show'] = false;
} else
    $this->_sections['name']['total'] = 0;
if ($this->_sections['name']['show']):

            for ($this->_sections['name']['index'] = $this->_sections['name']['start'], $this->_sections['name']['iteration'] = 1;
                 $this->_sections['name']['iteration'] <= $this->_sections['name']['total'];
                 $this->_sections['name']['index'] += $this->_sections['name']['step'], $this->_sections['name']['iteration']++):
$this->_sections['name']['rownum'] = $this->_sections['name']['iteration'];
$this->_sections['name']['index_prev'] = $this->_sections['name']['index'] - $this->_sections['name']['step'];
$this->_sections['name']['index_next'] = $this->_sections['name']['index'] + $this->_sections['name']['step'];
$this->_sections['name']['first']      = ($this->_sections['name']['iteration'] == 1);
$this->_sections['name']['last']       = ($this->_sections['name']['iteration'] == $this->_sections['name']['total']);
?>
                        <li id="p<?php echo $this->_tpl_vars['key']+$this->_sections['name']['index']+1; ?>
" data-itemid='<?php echo $this->_tpl_vars['key']+$this->_sections['name']['index']+1; ?>
'>
                            <div nc_type="handle_image">
                                <div class="image">
                                    <input name="pic[]" type="hidden" id="pic<?php echo $this->_sections['name']['index']; ?>
" value="" />
                                    <img width="60" id="pic<?php echo $this->_sections['name']['index']; ?>
_img" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/default/nopicsmall.gif"  />
                                </div>
                                <div nc_type="handle" class="bg">
                                <span title="删除" nctype="delete_image" class="delete">删除</span>
                                </div>
                            </div>
                            <div class="upload-btn"><a class="upload-button" href="javascript:uploadfile('Style images','pic<?php echo $this->_sections['name']['index']; ?>
',640,640,'product')">上传</a></div>
                        </li>
                    <?php endfor; endif; ?>
                </ul>
            </div>
        </td>
    </tr>
    <tr>
        <td width="70">海关分类:</td>
        <td width="100">
         <select class="ws350" name='customs_cat'  id="customs_cat">
                <option value='0' rate="<?php echo $this->_tpl_vars['de']['tax_rate']; ?>
" hscode="<?php echo $this->_tpl_vars['de']['hscode']; ?>
">全部分类</option>
                <?php $_from = $this->_tpl_vars['customs_cat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                
                <option value="<?php echo $this->_tpl_vars['list']['catid']; ?>
" rate="<?php echo $this->_tpl_vars['list']['tax_rate']; ?>
" hscode="<?php echo $this->_tpl_vars['list']['hscode']; ?>
" tax_paid_price="<?php echo $this->_tpl_vars['list']['tax_paid_price']; ?>
" <?php if ($this->_tpl_vars['de']['hscode'] != '' && $this->_tpl_vars['list']['hscode'] == $this->_tpl_vars['de']['hscode']): ?>selected<?php endif; ?> <?php if ($this->_tpl_vars['list']['scat']): ?>disabled<?php endif; ?>><?php echo $this->_tpl_vars['list']['cat']; ?>
</option>
                   
                    <?php $_from = $this->_tpl_vars['list']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                    <option value="<?php echo $this->_tpl_vars['slist']['catid']; ?>
" rate="<?php echo $this->_tpl_vars['slist']['tax_rate']; ?>
" hscode="<?php echo $this->_tpl_vars['slist']['hscode']; ?>
" tax_paid_price="<?php echo $this->_tpl_vars['slist']['tax_paid_price']; ?>
" <?php if ($this->_tpl_vars['de']['hscode'] != '' && $this->_tpl_vars['slist']['hscode'] == $this->_tpl_vars['de']['hscode']): ?>selected<?php endif; ?> <?php if ($this->_tpl_vars['slist']['scat']): ?>disabled<?php endif; ?>>|__<?php echo $this->_tpl_vars['slist']['cat']; ?>
</option>
                            
                            <?php $_from = $this->_tpl_vars['slist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                            <option value="<?php echo $this->_tpl_vars['lists']['catid']; ?>
" rate="<?php echo $this->_tpl_vars['lists']['tax_rate']; ?>
" hscode="<?php echo $this->_tpl_vars['lists']['hscode']; ?>
" tax_paid_price="<?php echo $this->_tpl_vars['lists']['tax_paid_price']; ?>
" <?php if ($this->_tpl_vars['de']['hscode'] != '' && $this->_tpl_vars['lists']['hscode'] == $this->_tpl_vars['de']['hscode']): ?>selected<?php endif; ?> <?php if ($this->_tpl_vars['lists']['scat']): ?>disabled<?php endif; ?>>|____<?php echo $this->_tpl_vars['lists']['cat']; ?>
</option>
                                <?php $_from = $this->_tpl_vars['lists']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['flist']):
?>
                                <option value="<?php echo $this->_tpl_vars['flist']['catid']; ?>
" rate="<?php echo $this->_tpl_vars['flist']['tax_rate']; ?>
" hscode="<?php echo $this->_tpl_vars['flist']['hscode']; ?>
" tax_paid_price="<?php echo $this->_tpl_vars['flist']['tax_paid_price']; ?>
" <?php if ($this->_tpl_vars['de']['hscode'] != '' && $this->_tpl_vars['flist']['hscode'] == $this->_tpl_vars['de']['hscode']): ?>selected<?php endif; ?> <?php if ($this->_tpl_vars['flist']['scat']): ?>disabled<?php endif; ?>>|______<?php echo $this->_tpl_vars['flist']['cat']; ?>
</option>
	                                <?php $_from = $this->_tpl_vars['flist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['flists']):
?>
	                                <option value="<?php echo $this->_tpl_vars['flists']['catid']; ?>
" rate="<?php echo $this->_tpl_vars['flists']['tax_rate']; ?>
" hscode="<?php echo $this->_tpl_vars['flists']['hscode']; ?>
" tax_paid_price="<?php echo $this->_tpl_vars['flists']['tax_paid_price']; ?>
" <?php if ($this->_tpl_vars['de']['hscode'] != '' && $this->_tpl_vars['flists']['hscode'] == $this->_tpl_vars['de']['hscode']): ?>selected<?php endif; ?>>|________<?php echo $this->_tpl_vars['flists']['cat']; ?>
</option>
	                                <?php endforeach; endif; unset($_from); ?>
                                <?php endforeach; endif; unset($_from); ?>
                            <?php endforeach; endif; unset($_from); ?>
                            
                    <?php endforeach; endif; unset($_from); ?> 
                    
                <?php endforeach; endif; unset($_from); ?> 
            </select>
            <input type="text" id="hscodeForSearch" placeholder="输入hscode搜索">
        </td>
    </tr>
    <tr>
        <td>税率</td>
        <td><input id="tax_rate" name="tax_rate" type="text" value="<?php if ($this->_tpl_vars['de']['tax_rate']): ?><?php echo $this->_tpl_vars['de']['tax_rate']; ?>
<?php endif; ?>" readonly/></td>
    </tr>
    
    <tr>
        <td>HSCODE</td>
        <td><input id="hscode" name="hscode" type="text" value="<?php if ($this->_tpl_vars['de']['hscode']): ?><?php echo $this->_tpl_vars['de']['hscode']; ?>
<?php endif; ?>" readonly/></td>
    </tr>
    <tr>
        <td>完税价</td>
        <td><input id="tax_paid_price" name="tax_paid_price" type="text" value="<?php if ($this->_tpl_vars['de']['tax_paid_price']): ?><?php echo $this->_tpl_vars['de']['tax_paid_price']; ?>
<?php endif; ?>" readonly/></td>
    </tr>
    
    <tr>
        <td>定价单位</td>
        <td><select name="unit"><option value="1">元</option></select></td>
    </tr>
    </tbody>
    </table>
    <table class="table" style="display:none;" id="default_sku_setting">
    
    <tbody>
    <tr>
        <td>默认SKU</td>
        <td class="property">
            <div>
            <table>
                <thead>
                <tr>
                    <td>销售价</td>
                    <td>分销价</td>
                    <td>市场指导价</td>
                    <td>申报价</td>
                    <td>库存</td>
                    <td>限购数量</td>
                </tr> 
                </thead>
                <tbody>
                <tr><td><input type="text" name="price" id="price" class="text"  value="<?php if ($this->_tpl_vars['de']['price']): ?><?php echo $this->_tpl_vars['de']['price']; ?>
<?php else: ?>0.00<?php endif; ?>" /></td>
                	<td>  <input type="text" name="dis_price" id="dis_price" class="text" value="<?php if ($this->_tpl_vars['de']['dis_price']): ?><?php echo $this->_tpl_vars['de']['dis_price']; ?>
<?php else: ?>0.00<?php endif; ?>" /> </td>
                	<td>  <input type="text" name="market_price" id="market_price" class="text" value="<?php if ($this->_tpl_vars['de']['market_price']): ?><?php echo $this->_tpl_vars['de']['market_price']; ?>
<?php else: ?>0.00<?php endif; ?>" /> </td>
                	<td>  <input type="text" name="declared_price" id="declared_price" class="text" value="<?php if ($this->_tpl_vars['de']['declared_price']): ?><?php echo $this->_tpl_vars['de']['declared_price']; ?>
<?php else: ?>0.00<?php endif; ?>" /> </td>
                	<td><input type="text" value="<?php echo $this->_tpl_vars['de']['stock']; ?>
" disabled style="background:#E7E7E7;" class="text"/></td>
                	<td> <input id="buy_limit" name="buy_limit" type="text" class="text" value="<?php echo ((is_array($_tmp=@$this->_tpl_vars['de']['buy_limit'])) ? $this->_run_mod_handler('default', true, $_tmp, 1) : smarty_modifier_default($_tmp, 1)); ?>
" stock="<?php echo $this->_tpl_vars['de']['buy_limit']; ?>
"/></td></tr>
                
                </tbody>
            </table>
            </div>
        </td>
    </tr>        
    </tbody>
    
    </table>
    <?php if ($this->_tpl_vars['firstvalue']['d']['0']): ?>
    <table class="table"  id="spec">
    <thead>
    <tr>
        <th colspan="2" class="partition">销售属性</th>
    </tr>
    </thead>
    
    <tbody class="firstvalue">
    <?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
    <tr <?php if ($this->_tpl_vars['list']['ignore']): ?>style="background:#eee;"<?php endif; ?>>
        <td><p><?php echo $this->_tpl_vars['list']['name']; ?>
</p>
        <p><input type="checkbox" style="margin-top:8px;" onclick="ignore_property('property_td_<?php echo $this->_tpl_vars['num']; ?>
',this)" ignore_type="property_td_<?php echo $this->_tpl_vars['num']; ?>
" <?php if ($this->_tpl_vars['list']['ignore']): ?><?php else: ?>checked<?php endif; ?>></p>
        </td>
        <td nc_type="property_td_<?php echo $this->_tpl_vars['num']; ?>
" class="property">
            <ul class="property_ul" <?php if ($this->_tpl_vars['list']['field'] == 'color'): ?>id="color"<?php endif; ?>>
                <?php echo $this->_tpl_vars['list']['item']; ?>

            </ul>
            <div class="clear"></div>
            <?php if ($this->_tpl_vars['list']['field'] == 'color'): ?>
                <table cellpadding="0" cellspacing="0" nc_type="color_img" style="display:none">
                    <thead>
                    <tr>
                        <td><?php echo $this->_tpl_vars['list']['name']; ?>
</td>
                        <td width="200">选择头图图片（无图片可不选）</td>
                        <td width="100">已有图片</td>
                    </tr>
                    </thead>
                    <tbody>
                    <?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['clist']):
?>
                    <?php if ($this->_tpl_vars['clist']['field'] == 'color'): ?>
                    <?php $_from = $this->_tpl_vars['clist']['color']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['slist']):
?>
                        <tr id="color_img_tr_<?php echo $this->_tpl_vars['num']; ?>
" style="display:none">
                            <td><?php echo $this->_tpl_vars['slist']['name']; ?>
</td>
                            <td align="center">
                            <input name="color_img[<?php echo $this->_tpl_vars['key']; ?>
_<?php echo $this->_tpl_vars['num']; ?>
]" type="hidden" id="color_img<?php echo $this->_tpl_vars['num']; ?>
" value="<?php echo $this->_tpl_vars['slist']['img']; ?>
" /> 
                            <a class="upload-button" href="javascript:choose_pic('color_img<?php echo $this->_tpl_vars['num']; ?>
')">选择</a>
                            
                            </td>
                            <td>
                            <img align="absmiddle" id="color_img<?php echo $this->_tpl_vars['num']; ?>
_img" class="imgs" src="<?php if ($this->_tpl_vars['slist']['img']): ?><?php echo $this->_tpl_vars['slist']['img']; ?>
<?php else: ?>../image/default/user_admin/transparent.gif<?php endif; ?>" />
                            
                            <span id="color_img<?php echo $this->_tpl_vars['num']; ?>
_del" del_id="color_img<?php echo $this->_tpl_vars['num']; ?>
"><?php if ($this->_tpl_vars['slist']['img']): ?><a href="javascript:;">(删)</a><?php else: ?>(无)<?php endif; ?></span>
                            
                            </td>
                        </tr>
                    <?php endforeach; endif; unset($_from); ?>
                    <?php endif; ?>
                    <?php endforeach; endif; unset($_from); ?>
                    </tbody>
                </table>
            <?php endif; ?>
        </td>
    </tr>
    <?php endforeach; endif; unset($_from); ?>
    </tbody>
    
    <tbody nc_type="property_tbody" style="display:none">
    <tr>
        <td>SKU设置</td>
        <td class="property">
            <div>
            <table>
                <thead>
                <tr>
                    <?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
                    <td><?php echo $this->_tpl_vars['list']['name']; ?>
</td>
                    <?php endforeach; endif; unset($_from); ?>
                    <td>SKU</td>
                    <td>销售价</td>
                    <td>分销价</td>
                    <td>市场指导价</td>
                    <td>申报价</td>
                    <td>库存</td>
                    <td>限购数量</td>
                    <td>物流重量(千克)</td>
                </tr> 
                </thead>
                <tbody nc_type="property_table"></tbody>
            </table>
            </div>
        </td>
    </tr>        
    </tbody>
    </table>
    
    <?php endif; ?>
    
    
    
    <?php if ($this->_tpl_vars['firstvalue']['s']['0']): ?>
    <table class="table" id="other">
    <thead>
    <tr>
        <th colspan="2" class="partition">其它属性</th>
    </tr>
    </thead>
    
    <tbody>
    <?php $_from = $this->_tpl_vars['firstvalue']['s']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
        <?php echo $this->_tpl_vars['list']; ?>

    <?php endforeach; endif; unset($_from); ?>
    <tr>
        <td colspan="99" class="height"></td>
    </tr>
    </tbody>   
    </table>
    <?php endif; ?>
    
    <?php if ($this->_tpl_vars['firstvalue']['p']): ?>
    <table class="table" id="parameter">
    <thead>
    <tr>
        <th colspan="2" class="partition">详细参数</th>
    </tr>
    </thead>
    
    <tbody>
    <?php $_from = $this->_tpl_vars['firstvalue']['p']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
        <tr><td width="100"><?php echo $this->_tpl_vars['num']; ?>
</td></tr>
        <?php $_from = $this->_tpl_vars['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['slist']):
?>
            <?php echo $this->_tpl_vars['slist']; ?>

        <?php endforeach; endif; unset($_from); ?>
    <?php endforeach; endif; unset($_from); ?>
    <tr>
        <td colspan="99" class="height"></td>
    </tr>
    </tbody>   
    </table>
    <?php endif; ?>
     <?php if ($this->_tpl_vars['allextfield']): ?>
    <table class="table" id="other">
    <thead>
    <tr>
        <th colspan="2" class="partition">扩展字段</th>
    </tr>
    </thead>
    
    <tbody>
    <?php $_from = $this->_tpl_vars['allextfield']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
        <?php echo $this->_tpl_vars['list']; ?>

    <?php endforeach; endif; unset($_from); ?>
    <tr>
        <td colspan="99" class="height"></td>
    </tr>
    </tbody>   
    </table>
    <?php endif; ?>
    
    <table class="table" id="detail">
    <thead>
    <tr>
        <th colspan="2" class="partition">商品详情</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td colspan="2" class="detail">
        <script charset="utf-8" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/lib/kindeditor/kindeditor-min.js"></script>
        <script>
            var editor;
            KindEditor.ready(function(K) {
                editor = K.create('textarea[name="detail"]', {
                langType :'<?php echo $this->_tpl_vars['config']['language']; ?>
'
            });
        });
        </script>
        <textarea name="detail" id="detail" style="width:100%; height:400px;"><?php echo $this->_tpl_vars['de']['detail']; ?>
</textarea>
        </td>
    </tr>
    </tbody>
    </table>
    <table class="table" id="logistics">
    <thead>
    <tr>
        <th colspan="2" class="partition">物流信息</th>
    </tr>
    </thead>
    
    <tbody>
    	
			<tr>
        <td width="100">发货仓库</td>
        <td>
                <select id="stock_shop" name="stock_shop" onchange="$('#shop_img_logo').attr('src','<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/admin/'+$(this).val()+'.png')">
                <option value="">----请选择----</option>
								<?php $_from = $this->_tpl_vars['stock_shops']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['item']):
?>
									<option value="<?php echo $this->_tpl_vars['item']['id']; ?>
" <?php if ($this->_tpl_vars['de']['stock_shop'] == $this->_tpl_vars['item']['id']): ?>selected<?php endif; ?>><?php echo $this->_tpl_vars['item']['show_title']; ?>
</option>
								<?php endforeach; endif; unset($_from); ?>
               </select>
							 <?php if ($this->_tpl_vars['de']['stock_shop']): ?><img src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/admin/<?php echo $this->_tpl_vars['de']['stock_shop']; ?>
.png" width="24" height="24" style="vertical-align:top;" id="shop_img_logo"><?php endif; ?>
            </div>
        </td>
    </tr>
    <tr>
        <td width="100">可送区域</td>
        <td>
            <input type="hidden" name="t" id="t" value="<?php echo ((is_array($_tmp=@$this->_tpl_vars['de']['area'])) ? $this->_run_mod_handler('default', true, $_tmp, "全国") : smarty_modifier_default($_tmp, "全国")); ?>
" />
            <input type="hidden" name="province" id="id_1" value="<?php echo $this->_tpl_vars['de']['province']; ?>
" />
            <input type="hidden" name="city" id="id_2" value="<?php echo $this->_tpl_vars['de']['city']; ?>
" />
            <input type="hidden" name="area" id="id_3" value="<?php echo $this->_tpl_vars['de']['areaid']; ?>
" />
            <?php if ($this->_tpl_vars['de']['area']): ?>
            <div id="d_1"><?php echo $this->_tpl_vars['de']['area']; ?>
&nbsp;&nbsp;<a href="javascript:sd();">编辑</a></div>
            <?php endif; ?>
            <div id="d_2" <?php if ($this->_tpl_vars['de']['area']): ?>class="hidden"<?php endif; ?>>
                <select id="select_1" onChange="selClass(this);">
                <option value="">--请选择--</option>
                <option value="0">全国</option>
                <?php echo $this->_tpl_vars['prov']; ?>

                </select>
                <select id="select_2" onChange="selClass(this);" class="hidden"></select>
                <select id="select_3" onChange="selClass(this);" class="hidden"></select>
            </div>
        </td>
    </tr>
    
    <tr>
        <td>物流重量(千克)</td>
        <td><input value="<?php if ($this->_tpl_vars['de']['weight']): ?><?php echo $this->_tpl_vars['de']['weight']; ?>
<?php else: ?>0<?php endif; ?>" id="weight" name="weight" type="text" /><a href="javascript:;" nc_type="set_weight">设置SKU重量</a></td>
    </tr>
    
    <tr>
        <td>物流体积(立方米)</td>
        <td><input value="<?php if ($this->_tpl_vars['de']['cubage']): ?><?php echo $this->_tpl_vars['de']['cubage']; ?>
<?php else: ?>0<?php endif; ?>" id="cubage" name="cubage" type="text" /></td>
    </tr>
    
    <tr>
        <td>备货期</td>
        <td>
        <input value="<?php echo $this->_tpl_vars['de']['waiting_time']; ?>
" id="waiting_time" name="waiting_time" type="text" />-
        <input value="<?php echo $this->_tpl_vars['de']['waiting_time_end']; ?>
" id="waiting_time_end" name="waiting_time_end" type="text" />天发货
        </td>
    </tr>
    
    <tr>
        <td colspan="99" class="height"></td>
    </tr>
    </tbody>
    </table>
  <!--   <table class="table" id="parts">
    <thead>
    <tr>
        <th colspan="2" class="partition">推荐组合商品</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td colspan="99" class="colspan">
            <table width="100%" class="alc">
               	<tr id="parts_tr" <?php if (! $this->_tpl_vars['de']['product_partss']): ?> style="display:none"<?php endif; ?>>
                    <th class="al">产品名称</th>
                    <th width="100">产品编号</th>
                    <th width="100">销售价</th>
                    <th width="100">市场价</th>
                    <th width="100">成本价</th>
                    <th width="100">库存</th>
                    <th width="100"></th>
                </tr>
                <?php $_from = $this->_tpl_vars['de']['product_partss']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                <?php $_from = $this->_tpl_vars['slist']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <tr>
                    <td class="al"><?php echo $this->_tpl_vars['list']['pname']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['code']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['price']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['show_price']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['cost_price']; ?>
</td>
                    <td stock="<?php echo $this->_tpl_vars['list']['amount']; ?>
"></td>
                    <td><div><a href="javascript:;" class="deleterow" onClick="deleterow(this,<?php echo $this->_tpl_vars['list']['id']; ?>
,'related')">删除</a></div></td>
                </tr>
                <?php endforeach; endif; unset($_from); ?>
                <?php endforeach; endif; unset($_from); ?>
                <tr>
                    <td colspan="99" class="al">
                        <a class="addtr" id="parts_button" nc_type="parts" href="javascript:void();">添加推荐组合</a>
						<input type="hidden" id="hidden_parts" name="product_parts" value="<?php if ($this->_tpl_vars['de']['product_parts']): ?><?php echo $this->_tpl_vars['de']['product_parts']; ?>
,<?php else: ?>0,<?php endif; ?>" />
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    </tbody>
    </table>
    <table class="table" id="give">
    <thead>
    <tr>
        <th colspan="2" class="partition">赠送产品</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td colspan="99" class="colspan">
            <table width="100%" class="alc">
               <tr id="give_tr" <?php if (! $this->_tpl_vars['de']['product_gives']): ?> style="display:none"<?php endif; ?>>
                    <th class="al">产品名称</th>
                    <th width="100">产品编号</th>
                    <th width="100">销售价</th>
                    <th width="100">市场价</th>
                    <th width="100">成本价</th>
                    <th width="100">库存</th>
                    <th width="100"></th>
                </tr>
                <?php $_from = $this->_tpl_vars['de']['product_gives']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                <?php $_from = $this->_tpl_vars['slist']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <tr>
                    <td class="al"><?php echo $this->_tpl_vars['list']['pname']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['code']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['price']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['show_price']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['cost_price']; ?>
</td>
                    <td stock="<?php echo $this->_tpl_vars['list']['amount']; ?>
"></td>
                    <td><div><a href="javascript:;" class="deleterow" onClick="deleterow(this,<?php echo $this->_tpl_vars['list']['id']; ?>
,'related')">删除</a></div></td>
                </tr>
                <?php endforeach; endif; unset($_from); ?>
                <?php endforeach; endif; unset($_from); ?>
                <tr>
                    <td colspan="99" class="al">
                    <a class="addtr" id="give_button" nc_type="give" href="javascript:void();">赠送产品</a>
                       <input type="hidden" id="hidden_give" name="product_give" value="<?php if ($this->_tpl_vars['de']['product_give']): ?><?php echo $this->_tpl_vars['de']['product_give']; ?>
,<?php else: ?>0,<?php endif; ?>" />
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    </tbody>
    </table>  -->
    <table class="table" id="related">
    <thead>
    <tr>
        <th colspan="2" class="partition">相关产品</th>
    </tr>
    </thead>
    
    <tbody>
    <tr>
        <td colspan="99" class="colspan">
            <table width="100%" class="alc">
                <tr id="related_tr" <?php if (! $this->_tpl_vars['de']['product_relateds']): ?> style="display:none"<?php endif; ?>>
                <th width="100">产品ID</th>
                    <th class="al">产品名称</th>
                    <th width="100">产品编号</th>
                    <th width="100">产品分类</th>
                    <th width="100">产品标签</th>
                    <th width="100">品牌</th>
                    <th width="100">销售价</th>
                    <th width="100">市场价</th>
                    <th width="100"></th>
                </tr>
                <?php $_from = $this->_tpl_vars['de']['product_relateds']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <tr>
                		<td><?php echo $this->_tpl_vars['list']['id']; ?>
</td>
                    <td class="al"><?php echo $this->_tpl_vars['list']['pname']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['code']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['catname']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['tags']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['brand']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['price']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['market_price']; ?>
</td>
                    <td><div><a href="javascript:;" class="deleterow" onClick="deleterow(this,<?php echo $this->_tpl_vars['list']['id']; ?>
,'related')">删除</a></div></td>
                </tr>
                <?php endforeach; endif; unset($_from); ?>
                <tr>
                    <td colspan="99" class="al">
                    <a class="addtr" id="related_button" nc_type="related" href="javascript:void();">相关产品</a>
                    <input type="hidden" id="hidden_related" name="product_related" value="<?php if ($this->_tpl_vars['de']['product_related']): ?><?php echo $this->_tpl_vars['de']['product_related']; ?>
,<?php else: ?>0,<?php endif; ?>" />
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    </tbody>
    </table>   
    <table>
    <tr>
        <td colspan="2" style="border-top:1px dotted #DEEFFB;">
            <input type="submit" value="<?php echo $this->_tpl_vars['lang']['submit']; ?>
" class="submit" onClick="$('#returnself').val(0);"/>
            <!---->
            <input type="submit" value="应用" class="submit" onClick="$('#returnself').val(1);"/>
            <input type="hidden" name="returnself"  value="0" id="returnself"/>
            <!---->
            <?php if ($this->_tpl_vars['de']['status'] == 0 || $this->_tpl_vars['de']['status'] == -1): ?>
            <input type="submit" value="送审" class="submit" onClick="$('#tocheck').val(1);"/>
            <input type="hidden" name="tocheck"  value="0" id="tocheck"/>
            <?php endif; ?>
            <input name="submit" type="hidden" value="<?php if ($this->_tpl_vars['de']['id']): ?>edit<?php else: ?>submit<?php endif; ?>" />
            <input name="editID" type="hidden" id="editID" value="<?php echo $this->_tpl_vars['de']['id']; ?>
" />
            <input type="hidden" name="statu" value="<?php echo $this->_tpl_vars['de']['status']; ?>
" />
            <input type="hidden" name="freightcon" value="0" />
            <input type="hidden" name="custom_cat" value="0" />
            <input type="hidden" name="rec_pro" value="0" />
            <input type="hidden" name="ptype" value="0" />
             <input type="hidden" name="property_id" value="<?php echo $this->_tpl_vars['property_id']; ?>
" />
        </td>
    </tr>
    </table>
</form>
</div>
</body>
</html>
<script language="javascript" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/product.js"></script>
<script language="javascript" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/jquery.dragsort-0.5.1.min.js"></script>
<script type="text/javascript">
/*
$.getJSON('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=inventory&s=classes.php&uri=api',function(data){
	//alert(data);
	$.each(data,function(key,item){
		$('#classes').append('<option value="'+item.id+'">'+item.title+'</option>');
		if(item.children){
			$.each(item.children,function(k,v){
				$('#classes').append('<option value="'+v.id+'">|——'+v.title+'</option>');

			})
		}
	})
})*/


/* 
function setinventory(spec){
	if(parent.$data){
	}else{
		alert('库存设置失败，请重试');	return false;
	}
	

	
		var d=spec!="0"?parent.$data[spec]:parent.$data.inventory;
		var total=0;
		var stock=0;
		var totalprice=0;
		var arr=[];
		//$('#stock').val(d);
		$.each(d,function(k,v){
			if(v){
				v.stocks=parseFloat(v.stocks);
			if(stock==0){
				stock=v.stocks;
			}else if(stock>v.stocks){
				//alert(stock)
					stock=v.stocks;
				}
			total+=parseInt(v.nums);
			totalprice+=v.nums*v.pricesell;
			
			arr.push(v.id+'_'+v.nums);
			
			}
		});
		totalprice=totalprice.toFixed(2);
	if(spec!=0){
		$('input[nc_type="'+spec+'|price"]').val(totalprice);
		$('input[nc_type="'+spec+'|show_price"]').val(totalprice);
		$('input[nc_type="'+spec+'|cost_price"]').val(totalprice);
		$('input[nc_type="'+spec+'|amount"]').val(stock);
		$('input[nc_type="'+spec+'|stock"]').val(arr.join(','));
		count_price('price');
		count_price('show_price');
		count_price('cost_price');
		count_price('market_price');
		
	}else{
		$('#stock').val(arr.join(','));
		$('input[name="price"]').val(totalprice);
		$('input[name="show_price"]').val(totalprice);
		$('input[name="cost_price"]').val(totalprice);
		$('#amount').val(stock);
		$('#inventorynum').html(total);
	}
} */


/* $('#clearinventory').click(function(){
	if(confirm('确认删除？')){
	$('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none').val('0.00');
	$('input[name="show_price"]').attr('readonly','readonly').css('background','#E7E7E7 none').val('0.00');
	$('input[name="cost_price"]').val('0.00');
	$('#amount').val(0);
	$('#inventorynum').html(0);
	$('#stock').val('');
		parent.$data.inventory={};
	}
	
})
 */

$('.addtr').live('click',function(){
	type=$(this).attr('nc_type');
	spec=$(this).attr('spec')||0;
	if(type=='inventory'){
		title="选择库存商品";
		window.parent.iframe_form(type,title,'<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=inventory_list.php&type='+type+'&spec='+spec, 800, 505);
		return false;
	}
	
	if(type=='parts') title="选择添加配件";
	if(type=='give') title="选择赠送产品";
	if(type=='related') title="选择相关产品";
	window.parent.iframe_form(type,title,'<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_list.php&id=<?php echo $this->_tpl_vars['de']['id']; ?>
&type='+type, 800, 505);
	return false;
	});

$('.itemtitle ul li').unbind().each(function(){
	$(this).click(function(){
		id=$(this).children().attr('id');
		$(this).addClass("current").siblings().removeClass("current");	
		if(id=='base')
			$(".container").find("table").removeClass("hidden");
		else
			$(".container").find("#"+id).removeClass("hidden").siblings(".table").addClass("hidden");	
	});
});

var rowtypedata = [
	[
		[1, ''], 
		[1, '', 'al'], 
		[1, ''], 
		[1, ''], 
		[1, ''], 
		[1, ''],
		[1, ''],
		[1, ''],
		[1, '<div><a href="javascript:;" class="deleterow" onClick="deleterow(this,{1})">删除</a></div>']
	
	]
];
var addrowdirect = 0;
var addrowkey = 0;
function addrow(name, type) {
	
	$('#'+name+'_tr').show();
	var obj=$('#'+name+'_button')[0];	
	var table = obj.parentNode.parentNode.parentNode.parentNode;
	var iframe=window.parent.document.getElementById("iframe_"+name).contentWindow;
	var tab=iframe.document.getElementById(name+"_table");
	var checkbox= $(tab).find("input[class='checkitem']:checked");
	var typedata = rowtypedata[type];
	$.each(checkbox,function(i){
		var value1=$("#hidden_"+name).val();
		var value2=this.value
		if(value1.indexOf(','+value2+',') <= 0 )
		{
			$("#hidden_"+name).val(value1+value2+',');	
			var tr=$(this).parent().parent();
			if(!addrowdirect) {
				var row = table.insertRow(obj.parentNode.parentNode.rowIndex);
			} else {
				var row = table.insertRow(obj.parentNode.parentNode.rowIndex + 1);
			}
			for(var i = 0; i <= typedata.length - 1; i++) {
				if(i<=8)
				{
					var cell = row.insertCell(i);
					if(i==8)
					{
						var tmp = typedata[i][1];
					}
					else
					{
						var tmp = tr.find('td')[i+1].innerHTML;
					}
					if(i==1){
						cell.className = typedata[i][2];
					}
					tmp = tmp.replace(/\{(n)\}/g, function($1) {return addrowkey;});
					tmp = tmp.replace(/\{(\d+)\}/g, function($1, $2) { return value2+',\''+name+'\''; });
					cell.innerHTML = tmp;
				}
			}
			addrowkey ++;
			addrowdirect =0;
		}
	});
}

function deleterow(obj,id,name) {
	var table = obj.parentNode.parentNode.parentNode.parentNode.parentNode;
	var tr = obj.parentNode.parentNode.parentNode;
	var value=$("#hidden_"+name).val();

	var pattern = ','+id+',';
	str = value.replace(new RegExp(pattern), ",");
	$("#hidden_"+name).val(str);
	table.deleteRow(tr.rowIndex);
}

$("#list1").dragsort({ dragSelector: "div", dragSelectorExclude:"span",dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "<li class='placeHolder'><div></div></li>" });

function saveOrder()
{
	var data = $("#list1 li").map(function() { return $(this).data("itemid"); }).get();
};

function check_value()
{
	if(!document.getElementById('title').value)
	{
		alert('<?php echo $this->_tpl_vars['lang']['notice_title']; ?>
');
		document.getElementById('title').focus();
		return false;
	}
	if(document.getElementById('catid').value=='')
	{
		alert('<?php echo $this->_tpl_vars['lang']['product_category']; ?>
');
		return false;
	}
	if($('#brandid').val()==''){
		alert('请选择品牌');
		$('#brand').focus();
        return false;
	}
    if(($('#tax_rate').val()<=0) || ($('#hscode').val()=='')){
    	alert('请选择海关分类');
        $('#customs_cat').focus();
        return false;
    }
	if(parseFloat($('#price').val())>0)
	{
		var pr = $('#price').val();
		var mpr=$('#market_price').val();
		var dpr=$('#dis_price').val();
		var dcpr=$('#declared_price').val();
		
		if(pr.length>10||!pr.match(/^(:?(:?\d+.\d+)|(:?\d+))$/))
		{
			alert('产品价格错误');
			$('#price').focus();
			return false;
		}
		if(mpr.length>10||!mpr.match(/^(:?(:?\d+.\d+)|(:?\d+))$/))
		{
			alert('指导价格错误');
			$('#market_price').focus();
			return false;
		}
		if(dpr.length>10||!dpr.match(/^(:?(:?\d+.\d+)|(:?\d+))$/))
		{
			alert('分销价格错误');
			$('#dis_price').focus();
			return false;
		}
		if(dcpr.length>10||!dcpr.match(/^(:?(:?\d+.\d+)|(:?\d+))$/))
		{
			alert('申报价格错误');
			$('#declared_price').focus();
			return false;
		}
		if(parseFloat(pr)>parseFloat(mpr)){
			alert('指导价不能小于销售价');
            $('#market_price').focus();
            return false;
		}
		if(parseFloat(dpr)>parseFloat(pr)){
			alert('分销价不能大于销售价');
            $('#dis_price').focus();
            return false;
		}
		if(parseFloat(dcpr)>parseFloat(pr)){
			 if(!confirm('申报价大于销售价是否保存？')){
              $('#declared_price').focus();
              return false;
             }
		}
	}
	else
	{	
		alert('请填写产品价格');
		$('#price').focus();
		return false;
	}
	
	
	if(parseFloat($('#dis_price').val())<=0)
	{
		alert('请填写产品分销价格');
		$('#dis_price').focus();
		return false;
	}
	if(parseFloat($('#declared_price').val())<=0)
	{
		alert('请填写产品申报价格');
		$('#declared_price').focus();
		return false;
	}
	
	
	if(!$('#stock_shop').val()){
		alert('请选择发货仓库');
        return false;
	}
	
	if(!(parseFloat($('#weight').val())>0)){
		alert('请填写重量');
        return false;
	}
	if($('#tags').val()==null){
		alert('请选择标签');
        return false;
	}
	
	var w_time = $('#waiting_time').val();
	var w_time_end = $('#waiting_time_end').val();
	w_time = w_time?w_time:0;
	w_time_end = w_time_end?w_time_end:0;
	if(parseInt(w_time) > parseInt(w_time_end)){
		alert('请正确填写备货期');
        $('#waiting_time_end').focus();
        return false;
	}
/*	if($('#amount').val()=='')
	{
		alert('请填写库存数量');
		document.getElementById('amount').focus();
		return false;
	}*/
	
	/* if($('#id_3').val()=='')
	{
		alert('请选择产品所在区域');
		return false;
	} */
	var sku_setting=true;
	$('input[ignore_type]:checked').each(function(){
		
		if($('td[nc_type="'+$(this).attr('ignore_type')+'"]').find('input[type="checkbox"]:checked').size()==0){
			sku_setting=false;
			return false;
		}
	});
	if(!sku_setting){
		alert('请至少选择一个销售属性');
		return false;
	}
	
	
}
function load_pic()
{
	

	
	$.getScript("<?php echo $this->_tpl_vars['config']['weburl']; ?>
/script/product.js",function(){
			$('[nc_type="handle_image"]').each(function(){
				
		if(!$(this).find(':input').val()){
			
			return true;
		}
		else if($(this).parent().find('.show_big').size()){
			return true;
		}
		else{
			var $d=$('<div class="show_big"></div>').hover(function(){
				var _left=$(this).offset().left;
				var _top =$(this).offset().top;
				var $$=$(this).next().find('img').attr('src');
				$('<img id="biger_img" width="300" height="300" style="position:absolute;z-index:999;left:'+(_left-(-11))+'px;top:'+(_top-(-11))+'px;"/>').attr('src',$$).appendTo($(document.body));
			},function(){
				$('#biger_img').remove();
			})
			$(this).before($d);
		}
	});
	});
}

/*-------------销售属性------------------*/
var property_checked = [<?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?><?php if ($this->_tpl_vars['num']+1 == count($this->_tpl_vars['firstvalue']['d'])): ?>''<?php else: ?>'',<?php endif; ?><?php endforeach; endif; unset($_from); ?>];
var str = '';
var property_color;
var V = new Array();
<?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
var property_checked_<?php echo $this->_tpl_vars['num']; ?>
 = new Array();
<?php if ($this->_tpl_vars['list']['field'] == 'color'): ?>
 property_color=<?php echo $this->_tpl_vars['num']; ?>
;
<?php endif; ?>
<?php endforeach; endif; unset($_from); ?>

$(function(){
	/************zx************/
	$('input[name=code]').css('background','#E7E7E7 none');
	
	/* $('input[name="amount"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	
	$('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="show_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none'); */

	/*************zx****************/
	
	
	
	$('tbody[nc_type="property_table"]').find('input[type="text"]').live('change',function(){
		s = $(this).attr('nc_type');
		V[s] = $(this).val();
	});
	$('span[nc_type="chk"] > input[type="checkbox"]').click(function(){
		into_set();
	});
	$('span[nc_type="chk"] > input[type="checkbox"]').click(function(){
		stock_set();
	});
	
	
	$('a[nc_type="set_weight"]').click(function(){
		
		weight_set();
		
	})
	
	$('input[data_type="stock"]').live('change',function(){
		//count_stock();
	});
	$('input[data_type="sku"]').live('change',function(){
		//code();
	});
	$('input[data_type="price"]').live('change',function(){
		count_price('price');
		count_price('dis_price');
	});
	$('input[data_type="dis_price"]').live('change',function(){
		count_price('price');
		count_price('dis_price');
	});
	$('input[data_type="declared_price"]').live('change',function(){
		count_price('declared_price');
	});
	$('input[data_type="market_price"]').live('change',function(){
		count_price('market_price');
	});
	$('#color').find('input[type="checkbox"]').click(function(){
		pic_show($(this));
	});
	
	$('input[type="submit"]').click(function(){
		$('input[data_type="price"]').each(function(){
			if($(this).val() == ''){
				$(this).val($('input[name="price"]').val());
			}
		});
		$('input[data_type="stock"]').each(function(){
			if($(this).val() == ''){
				$(this).val('0');
			}
		});
		if($('dl[nc_type="property_tbody"]').css('display') == 'none'){
			$('dl[nc_type="property_tbody"]').find('input').attr('disabled','disabled');
		}
	});
	
});

function into_set(){
	
	<?php $_from = $this->_tpl_vars['firstvalue']['d']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['list']):
?>
	property_checked_<?php echo $this->_tpl_vars['num']; ?>
 = new Array();
	
	if($('input[type="checkbox"][ignore_type="property_td_<?php echo $this->_tpl_vars['num']; ?>
"]').is(':checked')){
	$('td[nc_type="property_td_<?php echo $this->_tpl_vars['num']; ?>
"]').find('input[type="checkbox"]:checked').each(function(){
		v = $(this).attr('nc_type');
		i = $(this).val();
	
		property_checked_<?php echo $this->_tpl_vars['num']; ?>
[property_checked_<?php echo $this->_tpl_vars['num']; ?>
.length] = [v,i];
	});
	}else if($('input[ignore_type]:checked').size()>0){
		property_checked_<?php echo $this->_tpl_vars['num']; ?>
[0] = ['-',0];
	}
	property_checked[<?php echo $this->_tpl_vars['num']; ?>
] = property_checked_<?php echo $this->_tpl_vars['num']; ?>
;
	<?php endforeach; endif; unset($_from); ?>

}


function ignore_property(property,obj){
	
	if($('#editID').val()>0?confirm('调整销售属性会重置所有sku，确认？'):1){
	
	if($(obj).is(':checked')){
		$(obj).parents('tr:eq(0)').css('background','none');
		$('td[nc_type="'+property+'"]').find('input[type="checkbox"]').removeAttr('disabled');
	}else{
		$('#color').find('input[type="checkbox"]:checked').each(function(){
			$(this).removeAttr('checked');
			pic_show($(this));
		});
		$('td[nc_type="'+property+'"]').find('input[type="checkbox"]:checked').removeAttr('checked');

		into_set();stock_set();
		$(obj).parents('tr:eq(0)').css('background','#eee');
		$('td[nc_type="'+property+'"]').find('input[type="checkbox"]').attr('disabled','disabled');


	}
	
	}else{
		if($(obj).is(':checked')){
			$(obj).removeAttr('checked');
		}else{
			$(obj).attr('checked','checked');

		}
	}
}

function weight_set(){
	
	if($('tbody[nc_type="property_table"]').is(':hidden')){
		return;
	}
	
	var wt=$('#weight').val();
	
	$('table[id=spec]').find('input').eq(0).focus();
	$('input[data_type="weight"]').attr('readonly','').css('background','').each(function(){
		if(!parseFloat($(this).val())){
			$(this).val(wt);
		}
		
	}).eq(0).focus();
}



function stock_set(){
	
	/* $('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="show_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none'); */
	$('input[name="code"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	
	$('tbody[nc_type="property_tbody"]').show();
	$('#default_sku_setting').hide();
	str = '<tr>';
		
	<?php echo $this->_tpl_vars['abc']; ?>

	
	if(str == '<tr>'){
		//$('input[name="price"]').attr('readonly','').css('background','');
		//$('input[name="show_price"]').attr('readonly','').css('background','');
		//$('input[name="cost_price"]').attr('readonly','').css('background','');
		//$('input[name="amount"]').attr('readonly','').css('background','');
		//$('input[name="code"]').attr('readonly','').css('background','');
		$('tbody[nc_type="property_tbody"]').hide();
		$('#default_sku_setting').show();
	}
	
	var i=0;
	$('tbody[nc_type="property_table"]')
		.empty()
		.html(str)
		.find('input[type="text"]').each(function(){
			s = $(this).attr('nc_type');
			try{$(this).val(V[s])}catch(ex){$(this).val('')};
			if($(this).attr('data_type') == 'price' && $(this).val() == ''){
				$(this).val($('input[name="price"]').val());
			}
			if($(this).attr('data_type') == 'dis_price' && $(this).val() == ''){
				$(this).val($('input[name="dis_price"]').val());
			}
			if($(this).attr('data_type') == 'declared_price' && $(this).val() == ''){
				$(this).val($('input[name="declared_price"]').val());
			}
			if($(this).attr('data_type') == 'market_price' && $(this).val() == ''){
				$(this).val($('input[name="market_price"]').val());
			}
			if($(this).attr('data_type') == 'sku' && $(this).val() == ''){
				$(this).val('添加商品自动生成');
			}
			if($(this).attr('data_type') == 'buy_limit' && $(this).val() == ''){
				$(this).val($('input[name="buy_limit"]').val());
			}
		});
	//count_stock();
	count_price('price');
	count_price('dis_price');
	count_price('declared_price');
	count_price('market_price');
	//code();
}

function count_stock(){
	var stock = 0;
	$('input[data_type="stock"]').each(function(){
		if($(this).val() != ''){
			stock += parseInt($(this).val());
		}
	});
	$('input[name="amount"]').val(stock);
}

function code(){
	var max = 0.01;
	var min = 10000000;
	$('input[data_type="sku"]').each(function(){
		if($(this).val() != ''){
			max = Math.max(max,$(this).val());
			min = Math.min(min,$(this).val());
		}
	});
	if($('input[name="code"]').val()!='0' && !$('input[name="code"]').val())
	{
		if(min != 10000000){
			$('input[name="code"]').val(min);
		}
	}
}

function count_price(obj){
	var max = 0.01;
	var min = 10000000;
	$('input[data_type="'+obj+'"]').each(function(){
		if($(this).val() != ''){
			max = Math.max(max,$(this).val());
			min = Math.min(min,$(this).val());
		}
	});
	if(min != 10000000){
		$('input[name="'+obj+'"]').val(min.toFixed(2));
	}
}

function pic_show(Obj){
	var V = $('#color').find('input[type="checkbox"]:checked');
	if(V.length == 0){	
		$('table[nc_type="color_img"]').hide();
	}else{
		$('table[nc_type="color_img"]').show();
	}
	var S = $('tr[id="color_img_tr_'+Obj.val()+'"]');
	if(S.css('display') == 'none'){
		S.show();
	}else{
		S.hide();
	}
}


function choose_pic(obj)
{	
	var pic_info='';
	
	$.each($(":input[name='pic\[\]']"),function(k,v){
		if(!$(v).val())return;
		//alert($(v).val());
		pic_info+='<li><div class="image"><img src="'+$(v).val()+'" width="60"></div><div class="upload-btn" style="cursor: pointer;"><a href="javascript:;" chose_pic="'+$(v).val()+'" class="upload-button">设为首图</a></div></li>';
		
	});
	
	if(pic_info==''){
		pic_info='<li>无可选图片，<br/>请先上传</li>';
	}
	
	
	
	alertWin('选择图片', '<div class="product_image"><ul>'+pic_info+'</ul></div>',650, 330);
	$('[chose_pic]').click(function(){
		//alert(obj);
		$('#'+obj).val($(this).attr('chose_pic'));
		$('#'+obj+'_img').attr('src',$(this).attr('chose_pic'));
		$('#'+obj+'_del').html('<a href="javascript:;">(删)</a>');
		close_win();
	})
}

$(function(){
	$('[del_id]').each(function(){ 
		var $span=$(this);var delid=$span.attr('del_id');
		$(this).find('a').live('click',function(){
			//alert($del_id);
			$span.html('(无)');
			$('#'+delid).val('');
			$('#'+delid+'_img').attr('src','../image/default/user_admin/transparent.gif');
		})
		
	})
	$('.imgs[id^=color_img]').live('hover',function(event){
			if(event.type=='mouseenter'){
				var _left=$(this).offset().left;
				var _top =$(this).offset().top;
				var $$=$(this).attr('src');
				$('<img id="biger_img" width="300" height="300" style="position:absolute;z-index:999;left:'+(_left-(-15))+'px;top:'+(_top-(-15))+'px;"/>').attr('src',$$).appendTo($(document.body));
			}else{
				$('#biger_img').remove();
			}
}) 
	
	
	
});


$(function(){
	var E_SP = new Array();
	var E_SPV = new Array();
	<?php $_from = $this->_tpl_vars['de']['porperty']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
		<?php $_from = $this->_tpl_vars['list']['setmeal']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
				<?php $_from = $this->_tpl_vars['slist']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['num'] => $this->_tpl_vars['val']):
?>
					E_SP[<?php echo $this->_tpl_vars['num']; ?>
] = '<?php echo $this->_tpl_vars['val']; ?>
';
					<?php endforeach; endif; unset($_from); ?>
						<?php endforeach; endif; unset($_from); ?>	
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|price'] = '<?php echo $this->_tpl_vars['list']['price']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|dis_price'] = '<?php echo $this->_tpl_vars['list']['dis_price']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|declared_price'] = '<?php echo $this->_tpl_vars['list']['declared_price']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|market_price'] = '<?php echo $this->_tpl_vars['list']['market_price']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|stock'] = '<?php echo $this->_tpl_vars['list']['stock']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|sku'] = '<?php echo $this->_tpl_vars['list']['code']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|buy_limit'] = '<?php echo $this->_tpl_vars['list']['buy_limit']; ?>
';
			E_SPV['i_<?php echo $this->_tpl_vars['list']['property_value_id']; ?>
|weight'] = '<?php echo $this->_tpl_vars['list']['weight']; ?>
';

	<?php endforeach; endif; unset($_from); ?>
	
	V = E_SPV;
	
	
	$('.firstvalue').find('input[type="checkbox"]').each(function(){
		/* $('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="show_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none'); 
		$('input[name="amount"]').attr('readonly','readonly').css('background','#E7E7E7 none');*/
		$('input[name="code"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('tbody[nc_type="property_tbody"]').show();
	});

	into_set();
	str = '<tr>';
	
	<?php echo $this->_tpl_vars['abc']; ?>

	
	if(str == '<tr>'){
		
		//$('input[name="price"]').attr('readonly','').css('background','');
		//$('input[name="show_price"]').attr('readonly','').css('background','');
		//$('input[name="cost_price"]').attr('readonly','').css('background','');
		//$('input[name="amount"]').attr('readonly','').css('background','');
		//$('input[name="code"]').attr('readonly','').css('background','');
		$('tbody[nc_type="property_tbody"]').hide();
		$('#default_sku_setting').show();
	}
	
	
	if($('input[ignore_type]:checked').size()==0){
		$('tbody[nc_type="property_tbody"]').hide();
		$('#default_sku_setting').show();
	}

	$('tbody[nc_type="property_table"]')
		.empty()
		.html(str)
		.find('input[type="text"],input[type="hidden"]').each(function(){
			if($(this).is('[stock]')){
				$(this).attr('stock',$(this).siblings('input').val());
				var $stock=$(this);
				$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=inventory_api.php&stock='+$(this).attr('stock'),function(data){
					$stock.val(data);
				});
			}else{
				s = $(this).attr('nc_type');
				if(s!='sp_value'){
					try{$(this).val(E_SPV[s])}catch(ex){$(this).val('')};	
				}
			}
		});
	
	$('#color').find('input[type="checkbox"]:checked').each(function(){
		pic_show($(this));
	});
});
/**********************zx**************/

//默认待选品牌
$('#brand').bind('click',function(e){
		$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product.php&operation=getbrand&brandname=',function(data){
			$('#brandlist').show();
			$('#brandlist').html(""+data);
		});
});
//直接搜品牌
$('#brand').bind('input',function(e){
	var value=$(this).val();
	if(value==''){
		$('#brandlist').hide();
		return ;
	}
	else{
		$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product.php&operation=getbrand&brandname='+value,function(data){
			$('#brandlist').show();
			$('#brandlist').html(""+data);
		});
	}
});
$('body').bind('click',function(e){
	$('#brandlist').hide();
});
$('#brandlist').delegate('li','click',function(){
	var _this=$(this);
	var brandName=_this.text();
		var brandId=_this.attr('bid');
		$('#brand').val(brandName);
		$('#brandid').val(brandId+'__'+brandName);
		$('#brandlist').hide();
});

/* parent.$data={};
$.each($('[stock]'),function(){
	//alert($(this).attr('stock'));
	var $stock=$(this);
	
	$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=inventory_api.php&stock='+$(this).attr('stock'),function(data){
		$stock.is('td')?$stock.html(data):$stock.val(data);
		$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=inventory_api.php&gettitle=1&stock='+$stock.attr('stock'),function(d){
			//alert(d);
			$('#gettitle').html(d);
		});
	});

	
}) */
</script>